﻿using System;
using System.Globalization;
using Cirrious.CrossCore.Converters;

namespace Bulb.Core.Converters
{
    public class TimeAgoValueConverter : MvxValueConverter<DateTime>
    {
        protected override object Convert(DateTime when, Type targetType, object parameter, CultureInfo culture)
        {
            var difference = (DateTime.Now - when).TotalDays;
            
            return string.Format( difference < 1 ? "Today @{0: HH:mm:ss}" : "{0: MM/dd/yy H:mm:ss}", when);
        }
    }
}
